Terminal终端美化(Oh My Posh) | 您所在的位置:网站首页 › oh my posh编码 › Terminal终端美化(Oh My Posh) |
安装Oh My Posh
可以先去Microsofe Store 安装winget,会比较方便 winget install JanDeDobbeleer.OhMyPosh 复制代码安装完: 会在C:\Users\自己用户名\AppData\Local\Programs\oh-my-posh\themes>有很多主题 预览所有主题命令 Get-PoshThemes 复制代码但会发现分隔符会有乱码的问题 乱码问题解决方式: 安装Nerd Fonts字体,在Terminal>Power Shell选择自己安装的字体,保存重启就生效啦。 PS:刚开始以为没有我常用的JetBrain Mono字体,就没在意这种解决方案,没想到里面字体挺丰富. 配置PowerShell因为应用的主题只在当前窗口有效果,所以需要配置每次PowerShell启动时都会执行应用主题的脚本 1.打开配置文件方式一 获取到PowerShell配置文件绝对路径 $PROFILE 复制代码如果安装了VS Code,如下命令可以直接打开Power Shell配置文件 code $PROFILE 复制代码 自定义主题可借鉴的up主题文件:gitee.com/NilTor/publ… 更多配置可查看官网配置文档 VS Code终端配置没有配置打开VS Code终端报错: The term 'oh-my-posh' is not recognized as a name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if a path was included, verify | that the path is correct and try again. 复制代码 在环境变量新增Oh My Posh路径下bin目录每次打开都会有这四句提示语,想要打开是干干净净的界面。 在PowerShell配置项中添加一个配置 ,配置参数 -NoLogo为隐藏提示语 "commandline": "自己的pwsh.exe的路径 -NoLogo", 复制代码完整配置参考 { "colorScheme": "Campbell", "font": { "face": "JetBrainsMono Nerd Font Mono" }, "guid": "{574e775e-4f2a-5b96-ac1e-a2962a402336}", "hidden": false, "name": "PowerShell", "source": "Windows.Terminal.PowershellCore", "commandline": "C:\\Program Files\\WindowsApps\\Microsoft.PowerShell_7.2.2.0_x64__8wekyb3d8bbwe\\pwsh.exe -NoLogo", "startingDirectory": null 复制代码 |
CopyRight 2018-2019 实验室设备网 版权所有 |